<?php
	/**
	 * The abstract TableFeedbackGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableFeedback subclass which
	 * extends this TableFeedbackGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableFeedback class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $FormId the value for intFormId (Unique)
	 * @property string $TitleEn the value for strTitleEn 
	 * @property string $TitleJp the value for strTitleJp 
	 * @property integer $SatisfactionRate the value for intSatisfactionRate (Not Null)
	 * @property string $UserName the value for strUserName (Not Null)
	 * @property string $Email the value for strEmail (Not Null)
	 * @property string $Comment the value for strComment 
	 * @property string $Public the value for strPublic 
	 * @property string $Enable the value for strEnable 
	 * @property QDateTime $FeedbackDate the value for dttFeedbackDate (Not Null)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property string $Companyname the value for strCompanyname 
	 * @property string $PublicProfile the value for strPublicProfile 
	 * @property string $PublicUserType the value for strPublicUserType 
	 * @property integer $PublicStatus the value for intPublicStatus 
	 * @property QDateTime $MemberSince the value for dttMemberSince 
	 * @property integer $Permission the value for intPermission 
	 * @property TableUserProject $User the value for the TableUserProject object referenced by intUserId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableFeedbackGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_feedback.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_feedback.form_id
		 * @var integer intFormId
		 */
		protected $intFormId;
		const FormIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_feedback.title_en
		 * @var string strTitleEn
		 */
		protected $strTitleEn;
		const TitleEnMaxLength = 200;
		const TitleEnDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.title_jp
		 * @var string strTitleJp
		 */
		protected $strTitleJp;
		const TitleJpMaxLength = 200;
		const TitleJpDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.satisfaction_rate
		 * @var integer intSatisfactionRate
		 */
		protected $intSatisfactionRate;
		const SatisfactionRateDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_feedback.user_name
		 * @var string strUserName
		 */
		protected $strUserName;
		const UserNameMaxLength = 100;
		const UserNameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.email
		 * @var string strEmail
		 */
		protected $strEmail;
		const EmailMaxLength = 100;
		const EmailDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.comment
		 * @var string strComment
		 */
		protected $strComment;
		const CommentMaxLength = 255;
		const CommentDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.public
		 * @var string strPublic
		 */
		protected $strPublic;
		const PublicMaxLength = 1;
		const PublicDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.enable
		 * @var string strEnable
		 */
		protected $strEnable;
		const EnableMaxLength = 1;
		const EnableDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.feedback_date
		 * @var QDateTime dttFeedbackDate
		 */
		protected $dttFeedbackDate;
		const FeedbackDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_feedback.companyname
		 * @var string strCompanyname
		 */
		protected $strCompanyname;
		const CompanynameMaxLength = 100;
		const CompanynameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.public_profile
		 * @var string strPublicProfile
		 */
		protected $strPublicProfile;
		const PublicProfileMaxLength = 100;
		const PublicProfileDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.public_user_type
		 * @var string strPublicUserType
		 */
		protected $strPublicUserType;
		const PublicUserTypeMaxLength = 100;
		const PublicUserTypeDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.public_status
		 * @var integer intPublicStatus
		 */
		protected $intPublicStatus;
		const PublicStatusDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.member_since
		 * @var QDateTime dttMemberSince
		 */
		protected $dttMemberSince;
		const MemberSinceDefault = null;


		/**
		 * Protected member variable that maps to the database column table_feedback.permission
		 * @var integer intPermission
		 */
		protected $intPermission;
		const PermissionDefault = null;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_feedback.user_id.
		 *
		 * NOTE: Always use the User property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUser
		 */
		protected $objUser;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableFeedback from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableFeedback::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableFeedback()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableFeedbacks
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableFeedback::QueryArray to perform the LoadAll query
			try {
				return TableFeedback::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableFeedbacks
		 * @return int
		 */
		public static function CountAll() {
			// Call TableFeedback::QueryCount to perform the CountAll query
			return TableFeedback::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();

			// Create/Build out the QueryBuilder object with TableFeedback-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_feedback');
			TableFeedback::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_feedback');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableFeedback object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableFeedback the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFeedback::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableFeedback object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableFeedback::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableFeedback::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableFeedback objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableFeedback[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFeedback::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableFeedback::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableFeedback objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFeedback::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();

			$strQuery = TableFeedback::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tablefeedback', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableFeedback::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableFeedback
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_feedback';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'form_id', $strAliasPrefix . 'form_id');
			$objBuilder->AddSelectItem($strTableName, 'title_en', $strAliasPrefix . 'title_en');
			$objBuilder->AddSelectItem($strTableName, 'title_jp', $strAliasPrefix . 'title_jp');
			$objBuilder->AddSelectItem($strTableName, 'satisfaction_rate', $strAliasPrefix . 'satisfaction_rate');
			$objBuilder->AddSelectItem($strTableName, 'user_name', $strAliasPrefix . 'user_name');
			$objBuilder->AddSelectItem($strTableName, 'email', $strAliasPrefix . 'email');
			$objBuilder->AddSelectItem($strTableName, 'comment', $strAliasPrefix . 'comment');
			$objBuilder->AddSelectItem($strTableName, 'public', $strAliasPrefix . 'public');
			$objBuilder->AddSelectItem($strTableName, 'enable', $strAliasPrefix . 'enable');
			$objBuilder->AddSelectItem($strTableName, 'feedback_date', $strAliasPrefix . 'feedback_date');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'companyname', $strAliasPrefix . 'companyname');
			$objBuilder->AddSelectItem($strTableName, 'public_profile', $strAliasPrefix . 'public_profile');
			$objBuilder->AddSelectItem($strTableName, 'public_user_type', $strAliasPrefix . 'public_user_type');
			$objBuilder->AddSelectItem($strTableName, 'public_status', $strAliasPrefix . 'public_status');
			$objBuilder->AddSelectItem($strTableName, 'member_since', $strAliasPrefix . 'member_since');
			$objBuilder->AddSelectItem($strTableName, 'permission', $strAliasPrefix . 'permission');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableFeedback from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableFeedback::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableFeedback
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableFeedback object
			$objToReturn = new TableFeedback();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'form_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'form_id'] : $strAliasPrefix . 'form_id';
			$objToReturn->intFormId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'title_en', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'title_en'] : $strAliasPrefix . 'title_en';
			$objToReturn->strTitleEn = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'title_jp', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'title_jp'] : $strAliasPrefix . 'title_jp';
			$objToReturn->strTitleJp = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'satisfaction_rate', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'satisfaction_rate'] : $strAliasPrefix . 'satisfaction_rate';
			$objToReturn->intSatisfactionRate = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_name'] : $strAliasPrefix . 'user_name';
			$objToReturn->strUserName = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'email', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'email'] : $strAliasPrefix . 'email';
			$objToReturn->strEmail = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'comment', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'comment'] : $strAliasPrefix . 'comment';
			$objToReturn->strComment = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'public', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'public'] : $strAliasPrefix . 'public';
			$objToReturn->strPublic = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'enable', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'enable'] : $strAliasPrefix . 'enable';
			$objToReturn->strEnable = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'feedback_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'feedback_date'] : $strAliasPrefix . 'feedback_date';
			$objToReturn->dttFeedbackDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'companyname', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'companyname'] : $strAliasPrefix . 'companyname';
			$objToReturn->strCompanyname = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'public_profile', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'public_profile'] : $strAliasPrefix . 'public_profile';
			$objToReturn->strPublicProfile = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'public_user_type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'public_user_type'] : $strAliasPrefix . 'public_user_type';
			$objToReturn->strPublicUserType = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'public_status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'public_status'] : $strAliasPrefix . 'public_status';
			$objToReturn->intPublicStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'member_since', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'member_since'] : $strAliasPrefix . 'member_since';
			$objToReturn->dttMemberSince = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'permission', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'permission'] : $strAliasPrefix . 'permission';
			$objToReturn->intPermission = $objDbRow->GetColumn($strAliasName, 'Integer');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_feedback__';

			// Check for User Early Binding
			$strAlias = $strAliasPrefix . 'user_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUser = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableFeedbacks from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableFeedback[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableFeedback::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableFeedback::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableFeedback object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableFeedback::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableFeedback()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load a single TableFeedback object,
		 * by FormId Index(es)
		 * @param integer $intFormId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback
		*/
		public static function LoadByFormId($intFormId, $objOptionalClauses = null) {
			return TableFeedback::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableFeedback()->FormId, $intFormId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by UserName Index(es)
		 * @param string $strUserName
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByUserName($strUserName, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByUserName query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->UserName, $strUserName),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by UserName Index(es)
		 * @param string $strUserName
		 * @return int
		*/
		public static function CountByUserName($strUserName) {
			// Call TableFeedback::QueryCount to perform the CountByUserName query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->UserName, $strUserName)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by Email Index(es)
		 * @param string $strEmail
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByEmail($strEmail, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByEmail query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->Email, $strEmail),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by Email Index(es)
		 * @param string $strEmail
		 * @return int
		*/
		public static function CountByEmail($strEmail) {
			// Call TableFeedback::QueryCount to perform the CountByEmail query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->Email, $strEmail)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by Public Index(es)
		 * @param string $strPublic
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByPublic($strPublic, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByPublic query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->Public, $strPublic),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by Public Index(es)
		 * @param string $strPublic
		 * @return int
		*/
		public static function CountByPublic($strPublic) {
			// Call TableFeedback::QueryCount to perform the CountByPublic query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->Public, $strPublic)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by Enable Index(es)
		 * @param string $strEnable
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByEnable($strEnable, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByEnable query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->Enable, $strEnable),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by Enable Index(es)
		 * @param string $strEnable
		 * @return int
		*/
		public static function CountByEnable($strEnable) {
			// Call TableFeedback::QueryCount to perform the CountByEnable query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->Enable, $strEnable)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by FeedbackDate Index(es)
		 * @param QDateTime $dttFeedbackDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByFeedbackDate($dttFeedbackDate, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByFeedbackDate query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->FeedbackDate, $dttFeedbackDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by FeedbackDate Index(es)
		 * @param QDateTime $dttFeedbackDate
		 * @return int
		*/
		public static function CountByFeedbackDate($dttFeedbackDate) {
			// Call TableFeedback::QueryCount to perform the CountByFeedbackDate query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->FeedbackDate, $dttFeedbackDate)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by SatisfactionRate Index(es)
		 * @param integer $intSatisfactionRate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayBySatisfactionRate($intSatisfactionRate, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayBySatisfactionRate query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->SatisfactionRate, $intSatisfactionRate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by SatisfactionRate Index(es)
		 * @param integer $intSatisfactionRate
		 * @return int
		*/
		public static function CountBySatisfactionRate($intSatisfactionRate) {
			// Call TableFeedback::QueryCount to perform the CountBySatisfactionRate query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->SatisfactionRate, $intSatisfactionRate)
			);
		}
			
		/**
		 * Load an array of TableFeedback objects,
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFeedback[]
		*/
		public static function LoadArrayByUserId($intUserId, $objOptionalClauses = null) {
			// Call TableFeedback::QueryArray to perform the LoadArrayByUserId query
			try {
				return TableFeedback::QueryArray(
					QQ::Equal(QQN::TableFeedback()->UserId, $intUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFeedbacks
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @return int
		*/
		public static function CountByUserId($intUserId) {
			// Call TableFeedback::QueryCount to perform the CountByUserId query
			return TableFeedback::QueryCount(
				QQ::Equal(QQN::TableFeedback()->UserId, $intUserId)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableFeedback
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_feedback` (
							`form_id`,
							`title_en`,
							`title_jp`,
							`satisfaction_rate`,
							`user_name`,
							`email`,
							`comment`,
							`public`,
							`enable`,
							`feedback_date`,
							`user_id`,
							`companyname`,
							`public_profile`,
							`public_user_type`,
							`public_status`,
							`member_since`,
							`permission`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intFormId) . ',
							' . $objDatabase->SqlVariable($this->strTitleEn) . ',
							' . $objDatabase->SqlVariable($this->strTitleJp) . ',
							' . $objDatabase->SqlVariable($this->intSatisfactionRate) . ',
							' . $objDatabase->SqlVariable($this->strUserName) . ',
							' . $objDatabase->SqlVariable($this->strEmail) . ',
							' . $objDatabase->SqlVariable($this->strComment) . ',
							' . $objDatabase->SqlVariable($this->strPublic) . ',
							' . $objDatabase->SqlVariable($this->strEnable) . ',
							' . $objDatabase->SqlVariable($this->dttFeedbackDate) . ',
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->strCompanyname) . ',
							' . $objDatabase->SqlVariable($this->strPublicProfile) . ',
							' . $objDatabase->SqlVariable($this->strPublicUserType) . ',
							' . $objDatabase->SqlVariable($this->intPublicStatus) . ',
							' . $objDatabase->SqlVariable($this->dttMemberSince) . ',
							' . $objDatabase->SqlVariable($this->intPermission) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_feedback', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_feedback`
						SET
							`form_id` = ' . $objDatabase->SqlVariable($this->intFormId) . ',
							`title_en` = ' . $objDatabase->SqlVariable($this->strTitleEn) . ',
							`title_jp` = ' . $objDatabase->SqlVariable($this->strTitleJp) . ',
							`satisfaction_rate` = ' . $objDatabase->SqlVariable($this->intSatisfactionRate) . ',
							`user_name` = ' . $objDatabase->SqlVariable($this->strUserName) . ',
							`email` = ' . $objDatabase->SqlVariable($this->strEmail) . ',
							`comment` = ' . $objDatabase->SqlVariable($this->strComment) . ',
							`public` = ' . $objDatabase->SqlVariable($this->strPublic) . ',
							`enable` = ' . $objDatabase->SqlVariable($this->strEnable) . ',
							`feedback_date` = ' . $objDatabase->SqlVariable($this->dttFeedbackDate) . ',
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`companyname` = ' . $objDatabase->SqlVariable($this->strCompanyname) . ',
							`public_profile` = ' . $objDatabase->SqlVariable($this->strPublicProfile) . ',
							`public_user_type` = ' . $objDatabase->SqlVariable($this->strPublicUserType) . ',
							`public_status` = ' . $objDatabase->SqlVariable($this->intPublicStatus) . ',
							`member_since` = ' . $objDatabase->SqlVariable($this->dttMemberSince) . ',
							`permission` = ' . $objDatabase->SqlVariable($this->intPermission) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableFeedback
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableFeedback with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_feedback`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableFeedbacks
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_feedback`');
		}

		/**
		 * Truncate table_feedback table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableFeedback::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_feedback`');
		}

		/**
		 * Reload this TableFeedback from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableFeedback object.');

			// Reload the Object
			$objReloaded = TableFeedback::Load($this->intId);

			// Update $this's local variables to match
			$this->intFormId = $objReloaded->intFormId;
			$this->strTitleEn = $objReloaded->strTitleEn;
			$this->strTitleJp = $objReloaded->strTitleJp;
			$this->intSatisfactionRate = $objReloaded->intSatisfactionRate;
			$this->strUserName = $objReloaded->strUserName;
			$this->strEmail = $objReloaded->strEmail;
			$this->strComment = $objReloaded->strComment;
			$this->strPublic = $objReloaded->strPublic;
			$this->strEnable = $objReloaded->strEnable;
			$this->dttFeedbackDate = $objReloaded->dttFeedbackDate;
			$this->UserId = $objReloaded->UserId;
			$this->strCompanyname = $objReloaded->strCompanyname;
			$this->strPublicProfile = $objReloaded->strPublicProfile;
			$this->strPublicUserType = $objReloaded->strPublicUserType;
			$this->intPublicStatus = $objReloaded->intPublicStatus;
			$this->dttMemberSince = $objReloaded->dttMemberSince;
			$this->intPermission = $objReloaded->intPermission;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'FormId':
					/**
					 * Gets the value for intFormId (Unique)
					 * @return integer
					 */
					return $this->intFormId;

				case 'TitleEn':
					/**
					 * Gets the value for strTitleEn 
					 * @return string
					 */
					return $this->strTitleEn;

				case 'TitleJp':
					/**
					 * Gets the value for strTitleJp 
					 * @return string
					 */
					return $this->strTitleJp;

				case 'SatisfactionRate':
					/**
					 * Gets the value for intSatisfactionRate (Not Null)
					 * @return integer
					 */
					return $this->intSatisfactionRate;

				case 'UserName':
					/**
					 * Gets the value for strUserName (Not Null)
					 * @return string
					 */
					return $this->strUserName;

				case 'Email':
					/**
					 * Gets the value for strEmail (Not Null)
					 * @return string
					 */
					return $this->strEmail;

				case 'Comment':
					/**
					 * Gets the value for strComment 
					 * @return string
					 */
					return $this->strComment;

				case 'Public':
					/**
					 * Gets the value for strPublic 
					 * @return string
					 */
					return $this->strPublic;

				case 'Enable':
					/**
					 * Gets the value for strEnable 
					 * @return string
					 */
					return $this->strEnable;

				case 'FeedbackDate':
					/**
					 * Gets the value for dttFeedbackDate (Not Null)
					 * @return QDateTime
					 */
					return $this->dttFeedbackDate;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'Companyname':
					/**
					 * Gets the value for strCompanyname 
					 * @return string
					 */
					return $this->strCompanyname;

				case 'PublicProfile':
					/**
					 * Gets the value for strPublicProfile 
					 * @return string
					 */
					return $this->strPublicProfile;

				case 'PublicUserType':
					/**
					 * Gets the value for strPublicUserType 
					 * @return string
					 */
					return $this->strPublicUserType;

				case 'PublicStatus':
					/**
					 * Gets the value for intPublicStatus 
					 * @return integer
					 */
					return $this->intPublicStatus;

				case 'MemberSince':
					/**
					 * Gets the value for dttMemberSince 
					 * @return QDateTime
					 */
					return $this->dttMemberSince;

				case 'Permission':
					/**
					 * Gets the value for intPermission 
					 * @return integer
					 */
					return $this->intPermission;


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUser) && (!is_null($this->intUserId)))
							$this->objUser = TableUserProject::Load($this->intUserId);
						return $this->objUser;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'FormId':
					/**
					 * Sets the value for intFormId (Unique)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intFormId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TitleEn':
					/**
					 * Sets the value for strTitleEn 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTitleEn = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TitleJp':
					/**
					 * Sets the value for strTitleJp 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTitleJp = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'SatisfactionRate':
					/**
					 * Sets the value for intSatisfactionRate (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSatisfactionRate = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UserName':
					/**
					 * Sets the value for strUserName (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strUserName = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Email':
					/**
					 * Sets the value for strEmail (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strEmail = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Comment':
					/**
					 * Sets the value for strComment 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strComment = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Public':
					/**
					 * Sets the value for strPublic 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPublic = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Enable':
					/**
					 * Sets the value for strEnable 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strEnable = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FeedbackDate':
					/**
					 * Sets the value for dttFeedbackDate (Not Null)
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttFeedbackDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUser = null;
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Companyname':
					/**
					 * Sets the value for strCompanyname 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strCompanyname = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PublicProfile':
					/**
					 * Sets the value for strPublicProfile 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPublicProfile = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PublicUserType':
					/**
					 * Sets the value for strPublicUserType 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPublicUserType = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PublicStatus':
					/**
					 * Sets the value for intPublicStatus 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPublicStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'MemberSince':
					/**
					 * Sets the value for dttMemberSince 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttMemberSince = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Permission':
					/**
					 * Sets the value for intPermission 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPermission = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserId = null;
						$this->objUser = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved User for this TableFeedback');

						// Update Local Member Variables
						$this->objUser = $mixValue;
						$this->intUserId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableFeedback"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="FormId" type="xsd:int"/>';
			$strToReturn .= '<element name="TitleEn" type="xsd:string"/>';
			$strToReturn .= '<element name="TitleJp" type="xsd:string"/>';
			$strToReturn .= '<element name="SatisfactionRate" type="xsd:int"/>';
			$strToReturn .= '<element name="UserName" type="xsd:string"/>';
			$strToReturn .= '<element name="Email" type="xsd:string"/>';
			$strToReturn .= '<element name="Comment" type="xsd:string"/>';
			$strToReturn .= '<element name="Public" type="xsd:string"/>';
			$strToReturn .= '<element name="Enable" type="xsd:string"/>';
			$strToReturn .= '<element name="FeedbackDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="User" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="Companyname" type="xsd:string"/>';
			$strToReturn .= '<element name="PublicProfile" type="xsd:string"/>';
			$strToReturn .= '<element name="PublicUserType" type="xsd:string"/>';
			$strToReturn .= '<element name="PublicStatus" type="xsd:int"/>';
			$strToReturn .= '<element name="MemberSince" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Permission" type="xsd:int"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableFeedback', $strComplexTypeArray)) {
				$strComplexTypeArray['TableFeedback'] = TableFeedback::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableFeedback::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableFeedback();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if (property_exists($objSoapObject, 'FormId'))
				$objToReturn->intFormId = $objSoapObject->FormId;
			if (property_exists($objSoapObject, 'TitleEn'))
				$objToReturn->strTitleEn = $objSoapObject->TitleEn;
			if (property_exists($objSoapObject, 'TitleJp'))
				$objToReturn->strTitleJp = $objSoapObject->TitleJp;
			if (property_exists($objSoapObject, 'SatisfactionRate'))
				$objToReturn->intSatisfactionRate = $objSoapObject->SatisfactionRate;
			if (property_exists($objSoapObject, 'UserName'))
				$objToReturn->strUserName = $objSoapObject->UserName;
			if (property_exists($objSoapObject, 'Email'))
				$objToReturn->strEmail = $objSoapObject->Email;
			if (property_exists($objSoapObject, 'Comment'))
				$objToReturn->strComment = $objSoapObject->Comment;
			if (property_exists($objSoapObject, 'Public'))
				$objToReturn->strPublic = $objSoapObject->Public;
			if (property_exists($objSoapObject, 'Enable'))
				$objToReturn->strEnable = $objSoapObject->Enable;
			if (property_exists($objSoapObject, 'FeedbackDate'))
				$objToReturn->dttFeedbackDate = new QDateTime($objSoapObject->FeedbackDate);
			if ((property_exists($objSoapObject, 'User')) &&
				($objSoapObject->User))
				$objToReturn->User = TableUserProject::GetObjectFromSoapObject($objSoapObject->User);
			if (property_exists($objSoapObject, 'Companyname'))
				$objToReturn->strCompanyname = $objSoapObject->Companyname;
			if (property_exists($objSoapObject, 'PublicProfile'))
				$objToReturn->strPublicProfile = $objSoapObject->PublicProfile;
			if (property_exists($objSoapObject, 'PublicUserType'))
				$objToReturn->strPublicUserType = $objSoapObject->PublicUserType;
			if (property_exists($objSoapObject, 'PublicStatus'))
				$objToReturn->intPublicStatus = $objSoapObject->PublicStatus;
			if (property_exists($objSoapObject, 'MemberSince'))
				$objToReturn->dttMemberSince = new QDateTime($objSoapObject->MemberSince);
			if (property_exists($objSoapObject, 'Permission'))
				$objToReturn->intPermission = $objSoapObject->Permission;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableFeedback::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->dttFeedbackDate)
				$objObject->dttFeedbackDate = $objObject->dttFeedbackDate->__toString(QDateTime::FormatSoap);
			if ($objObject->objUser)
				$objObject->objUser = TableUserProject::GetSoapObjectFromObject($objObject->objUser, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserId = null;
			if ($objObject->dttMemberSince)
				$objObject->dttMemberSince = $objObject->dttMemberSince->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableFeedback extends QQNode {
		protected $strTableName = 'table_feedback';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableFeedback';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'FormId':
					return new QQNode('form_id', 'FormId', 'integer', $this);
				case 'TitleEn':
					return new QQNode('title_en', 'TitleEn', 'string', $this);
				case 'TitleJp':
					return new QQNode('title_jp', 'TitleJp', 'string', $this);
				case 'SatisfactionRate':
					return new QQNode('satisfaction_rate', 'SatisfactionRate', 'integer', $this);
				case 'UserName':
					return new QQNode('user_name', 'UserName', 'string', $this);
				case 'Email':
					return new QQNode('email', 'Email', 'string', $this);
				case 'Comment':
					return new QQNode('comment', 'Comment', 'string', $this);
				case 'Public':
					return new QQNode('public', 'Public', 'string', $this);
				case 'Enable':
					return new QQNode('enable', 'Enable', 'string', $this);
				case 'FeedbackDate':
					return new QQNode('feedback_date', 'FeedbackDate', 'QDateTime', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'Companyname':
					return new QQNode('companyname', 'Companyname', 'string', $this);
				case 'PublicProfile':
					return new QQNode('public_profile', 'PublicProfile', 'string', $this);
				case 'PublicUserType':
					return new QQNode('public_user_type', 'PublicUserType', 'string', $this);
				case 'PublicStatus':
					return new QQNode('public_status', 'PublicStatus', 'integer', $this);
				case 'MemberSince':
					return new QQNode('member_since', 'MemberSince', 'QDateTime', $this);
				case 'Permission':
					return new QQNode('permission', 'Permission', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableFeedback extends QQReverseReferenceNode {
		protected $strTableName = 'table_feedback';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableFeedback';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'FormId':
					return new QQNode('form_id', 'FormId', 'integer', $this);
				case 'TitleEn':
					return new QQNode('title_en', 'TitleEn', 'string', $this);
				case 'TitleJp':
					return new QQNode('title_jp', 'TitleJp', 'string', $this);
				case 'SatisfactionRate':
					return new QQNode('satisfaction_rate', 'SatisfactionRate', 'integer', $this);
				case 'UserName':
					return new QQNode('user_name', 'UserName', 'string', $this);
				case 'Email':
					return new QQNode('email', 'Email', 'string', $this);
				case 'Comment':
					return new QQNode('comment', 'Comment', 'string', $this);
				case 'Public':
					return new QQNode('public', 'Public', 'string', $this);
				case 'Enable':
					return new QQNode('enable', 'Enable', 'string', $this);
				case 'FeedbackDate':
					return new QQNode('feedback_date', 'FeedbackDate', 'QDateTime', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'Companyname':
					return new QQNode('companyname', 'Companyname', 'string', $this);
				case 'PublicProfile':
					return new QQNode('public_profile', 'PublicProfile', 'string', $this);
				case 'PublicUserType':
					return new QQNode('public_user_type', 'PublicUserType', 'string', $this);
				case 'PublicStatus':
					return new QQNode('public_status', 'PublicStatus', 'integer', $this);
				case 'MemberSince':
					return new QQNode('member_since', 'MemberSince', 'QDateTime', $this);
				case 'Permission':
					return new QQNode('permission', 'Permission', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>